package com.atguigu.a_properties;

import java.util.Properties;
import java.util.Set;

public class Demo {
    public static void main(String[] args) {
        //创建属性集对象
        Properties properties = new Properties();

        //添加元素
        properties.setProperty("张三","18");
        properties.setProperty("李四","19");
        properties.setProperty("王五","20");

        System.out.println("properties = " + properties);

        //遍历集合
        Set<String> keys = properties.stringPropertyNames();

        for (String key : keys) {
            //调用getProperty
            String value = properties.getProperty(key);
            System.out.println(key + " -- " + value);
        }
    }
}
